package com.itjh.service.impl;

import com.itjh.AliYunOssUtils;
import com.itjh.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;


/**
 * Description:
 * 使用阿里云Oss的方式完成文件上传
 *
 * @Create 2025/1/18 12:00
 */

@Service
@Primary
public class FileServiceImpl2 implements FileService {

    @Autowired
    private AliYunOssUtils aliYunOssUtils;
    @Override
    public String saveFile(MultipartFile file) {
        /*
            面向AliYunOssUtils工具，调用工具的方法将 file 对象保存到阿里云的Oss
         */
        return aliYunOssUtils.uploadToOss(file);
    }
}
